package com.example.systemserver.controller;

import com.example.systemserver.bean.AccountBean;
import com.example.systemserver.bean.ResultBean;
import com.example.systemserver.service.AccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/account")
public class AccountController {


    @Autowired
    private AccountService accountService;

    @RequestMapping("/login")
    public ResultBean login(@RequestBody AccountBean accountBean) {
        log.info("/account/login,用户登录,请求参数:{}", accountBean);
        String token = accountService.login(accountBean);
        log.info("/account/login,用户登录,返回结果:{}", token);
        return new ResultBean(200, "登录成功", token);
    }

}
